#ifndef __RTC_H
#define __RTC_H
#include "Wire.h"
#include "RtcDS1307.h"
#include "ESP8266WiFi.h"
#include "NTPClient.h"
#include "WiFiUdp.h"

typedef struct RTC
{
    uint8_t year;
    uint8_t month;
    uint8_t date;
    uint8_t week;
    uint8_t hour;
    uint8_t min;
    uint8_t sec;
};

typedef enum
{
    NONE_INVALID = 0,
    YEAR_INVALID ,
    MONTH_INVALID,
    DATE_INVALID,
    WEEK_INVALID,
    DAY_INVALID,
    HOUR_INVALID,
    MIN_INVALILD,
    SEC_INVALID
};

extern RTC rtc;
extern RtcDateTime ds1338;
extern uint8_t time_set;

void rtcInit(void);
void rtcTask(void);

#endif